export const state = {
	//用户数据
	userInfo: {},
	ACCESS_TOKEN: ''
};
export const mutations = {
	//储存用户信息
	setUserInfo(state, data) {
		if (data) {
			state.userInfo = Object.assign({}, state.userInfo, data);
			// #ifdef H5
			window.sessionStorage.setItem('userInfo', JSON.stringify(state.userInfo));
			// #endif
			// #ifndef H5
			uni.setStorageSync('userInfo', state.userInfo);
			// #endif
		}
	},
	setToken(state, data) {
		if (data) {
			state.ACCESS_TOKEN = data
			// #ifdef H5
			window.sessionStorage.setItem('ACCESS_TOKEN', state.ACCESS_TOKEN);
			// #endif
			// #ifndef H5
			uni.setStorageSync('ACCESS_TOKEN', state.ACCESS_TOKEN);
			// #endif
		}
	},
};
export const actions = {
	Logout() {
		state.userInfo = {};
		// #ifdef H5
		window.sessionStorage.removeItem("userInfo");
		// #endif
		// #ifndef H5
		uni.removeStorageSync("userInfo");
		// #endif
	},
};
